<template>
  <div>
    <van-nav-bar
  :title="this.username2"
  
  >
  <template #right>
    <van-button @click="denglu_cbl">设置</van-button>
  </template>
  </van-nav-bar>
  <!-------------------------------- 主页面区 ------------------------------------>
  <div >
    <!-- 头像 -->
    <van-image
  round
  width="10rem"
  height="10rem"
  src="https://img.tukuppt.com/png_preview/00/41/05/HqXiMR37lD.jpg!/fw/780"
/>
用户：{{username}}
<div style="height:20px"></div>
<div><van-button plain type="primary" style="width:100%;height:100px" @click="go_home">去首页</van-button></div>
<div style="height:20px"></div>
<div><van-button plain type="primary" style="width:100%;height:100px" @click="go_gwc">我的购物车</van-button></div>
<div style="height:20px"></div>
<div><van-button plain type="primary" style="width:100%;height:100px" @click="go_dingdan">我的订单</van-button></div>
<div style="height:20px"></div>
<div><van-button plain type="primary" style="width:100%;height:100px" @click="go_back">退出</van-button></div>
  </div>


  <!---------------------------------- 主页面区 ---------------------------------------->




    
    <div style="height:67px"></div>
  </div>
</template>

<script>
import api from '@/api/api'
export default {
  data(){
    return {
      username:'',
      userid:'',
      usergwc:'',
    };
  },
  created(){
    if (this.$route.params && this.$route.params.id){
          this.userid= this.$route.params.id
          console.log(this.userid)
          api.getuserbyid(this.userid).then(res=>{
            this.username =res.data.name
          })
      }
  },
  methods:{
    go_home(){
      this.$router.push({ path: '/home/'+this.userid })
    },
    go_dingdan(){
      this.$router.push({ path: '/order/'+this.userid })
    },
    go_gwc(){
      this.$router.push({ path: '/GWC/'+this.userid })
    },
    go_back(){
      this.userid=''
      this.$router.push({ path: '/' })
    }
  }
};
</script>
